<link href="<?php echo Yii::app()->controller->imagePath; ?>css/jquery.lightbox-0.5.css" type="text/css" rel="stylesheet">
<script type="text/javascript" src="<?php echo Yii::app()->controller->imagePath; ?>js/jquery.lightbox-0.5.min.js"></script>
<script type="text/javascript">
$(function(){
	$('#preview').lightBox();
});
</script>	
    	     <?
//             if ($width!=null) {$width2='width="'.$width.'"'; }
//             if ($height!=null) {$height2='height="'.$height.'"'; }
	     if(!$files):
	     	print '<img src="' . Yii::app()->request->baseUrl.'/themes/'. Yii::app()->theme->name.'/images/foto_zagl.png" width="'.$width.'" height="'.$height.'"  alt="No photo" border="0">';
	     else:?>

	     <?php

      $file = $files[0];
      if ($percent) $widthImg = $percent;
      else $widthImg = $width;
		  $img = 'http://'.$_SERVER['HTTP_HOST'].Yii::app()->request->baseUrl.
		  ImageHelper::thumb($widthImg,$height,'/' . $file->file,array('method' => $thumbMethod));
			
			$imgPreview = 'http://'.$_SERVER['HTTP_HOST'].Yii::app()->request->baseUrl.
		  ImageHelper::thumb('800','600','/' . $file->file,array('method' => 'resize'));
			
		  $img_tag = '
				<a href="'.$imgPreview.'" id="preview">
					<img border=0 src="'.$img .'"  class="firstOnly">
				</a>
				';

      if($url)
		      print CHtml::link($img_tag, $url, array('class'=>'firstonly', 'title'=>$file->desc));
      else
          echo $img_tag;
		 ?>

		 <?endif;?>